package com.demo.study.behavior.d01_chainOfResponsibility.base.filter;

import com.demo.study.behavior.d01_chainOfResponsibility.base.Filter;
import com.demo.study.behavior.d01_chainOfResponsibility.base.Msg;
/**
 * @author Baymax
 * @since 2021/1/17
 */
public class NameFilter implements Filter {
    @Override
    public boolean doFilter(Msg msg) {
        if (isNull(msg.getName())) {
            return false;
        }
        String replace = msg.getMsg().replace("<name>", msg.getName());
        msg.setMsg(replace);
        return true;
    }
}
